<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>角色详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<body>

<form class="layui-form" action="">
  <div class="layui-row">
      <div class="layui-col-md2">
      <select name="idType" lay-verify="required" lay-filter="typeSelect" id="idType">
        <option value="0">UID</option>
        <option value="1">角色名</option>
        <option value="2">GUID</option>
        <option value="3">OpenID</option>
        <option value="4">-我不知道-</option>
      </select>
    </div>
    <div class="layui-col-md2">
      <select name="sid" lay-verify="required" id='server'>
      <% let is_first=true;%>
      <% for(let k in ret.server ) {%>
          <% if(is_first){%>
          <option value="<%=k%>" selected><%=ret.server[k]%></option>
          <% is_first=false;%>
          <%}else{%>
          <option value="<%=k%>" ><%=ret.server[k]%></option>
          <%}%>
      <%}%>
        <option value="999">-我不知道-</option>
      </select>
    </div>
     <div class="layui-col-md3">



      <input type="text" name="id" required  lay-verify="required" placeholder="请输入key" autocomplete="off" class="layui-input">
 </div>
  <div class="layui-col-md2">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="roleOK">立即提交</button>
    </div>
  </div>
  <div class="layui-col-md2">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="role996" id='996' style='display:none'>导入996</button>
    </div>
  </div>

        
</div>
</form>	


<div class="layui-collapse">
  <div class="layui-colla-item">
    <h2 class="layui-colla-title">角色</h2>
    <div class="layui-colla-content layui-show" id='roleInfo'></div>
  </div>
  <div class="layui-colla-item">
    <h2 class="layui-colla-title">背包</h2>
    <div class="layui-colla-content layui-show" id='bagInfo'></div>
  </div>
    <div class="layui-colla-item">
    <h2 class="layui-colla-title">每日</h2>
    <div class="layui-colla-content layui-show" id='dailyInfo'></div>
  </div>
  <div class="layui-colla-item">
    <h2 class="layui-colla-title">成就</h2>
    <div class="layui-colla-content layui-show" id='recordInfo'></div>
  </div> 
   <div class="layui-colla-item">
    <h2 class="layui-colla-title">任务</h2>
    <div class="layui-colla-content layui-show" id='taskInfo'></div>
  </div> 
   <div class="layui-colla-item">
    <h2 class="layui-colla-title">活动</h2>
    <div class="layui-colla-content layui-show" id='activeInfo'></div>
  </div>   
</div>





<script src="/layui/layui.js"></script>
<script>
layui.config({
    base: '/webui/'  // 模块目录
}).extend({
    "cosjs":"{/}/layui/?name=cosjs",
}).use(['form','cosjs','element'], function () {
    let branch = '/b/<%=branch%>';
    let form = layui.form,cosjs=layui.cosjs,$ = layui.jquery;
    $('#996').hide();

    let uid=null;

    form.on('submit(roleOK)', function(data){
      let  url =`${branch}/roleDetail/query`;
      cosjs.post(url,data.field).then(ret=>{
//        console.log(ret);
        uid=ret.ret.role._id;
        $('#roleInfo').text(JSON.stringify(ret.ret.role));
        $('#bagInfo').text(JSON.stringify(ret.ret.item));
        $('#dailyInfo').text(JSON.stringify(ret.ret.daily));
        $('#recordInfo').text(JSON.stringify(ret.ret.record));
        $('#taskInfo').text(JSON.stringify(ret.ret.task));
        $('#activeInfo').text(JSON.stringify(ret.ret.active));

        $('#996').show();
      }).catch(err=>{
        $('#roleInfo').text('');
        $('#bagInfo').text('');
        $('#dailyInfo').text('');
        $('#recordInfo').text('');
        $('#taskInfo').text('');
        $('#activeInfo').text('');
        $('#996').hide();
        cosjs.alert(err);
      })    
      return false;
    })

    form.on('submit(role996)', function(data){
      let  url =`${branch}/roleDetail/copy996`;
      data.field.uid=uid;
      cosjs.post(url,data.field).then(ret=>{
        cosjs.alert(ret.ret);
      }).catch(err=>{
        cosjs.alert(err);
      })
      return false;
    });




});
</script>
</body>
</html>